#include <iostream>
#include <cstdio>

int main(int argc, char const *argv[]){
    int n;
    while(scanf("%d", &n) != EOF && n != 0){
        int score_hash[101] = {0};
        for (int i = 0; i < n; i++){
            int score;
            scanf("%d", &score);
            score_hash[score]++;
        }
        int count_score;
        scanf("%d", &count_score);
        printf("%d\n", score_hash[count_score]);
    }
    return 0;
}